<?php

// @formatter:off
/**
 * @file WCRepresentationGroup.abs.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * $Id: WCRepresentationGroup.abs.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/includes/representations/WCRepresentationGroup.abs.php $
 */
// @formatter:on

/**
 * @abstract
 * @class WCRepresentationGroup
 */
abstract class WCRepresentationGroup extends WCRepresentation {
	//
	// Protected properties.
	/**
	 * @var WCGroup @todo doc
	 */
	protected $_group = false;
	//
	// Magic methods.
	public function __toString() {
		return $this->ok() ? "{$this->name()} ({$this->id()}[g:{$this->group}])" : "broken item";
	}
	//
	// Public methods.
	public function group() {
		if(!$this->_group) {
			$this->_group = WCGroupsHolder::I()->item($this->group);
		}

		return $this->_group;
	}
	public function reload() {
		$this->_group = false;
		return parent::reload();
	}
}
